(async function () {
	// 引入配置的路由
	const uiRouter = require("./severModules/uiRouters");
	const logicRouter = require("./severModules/logicRouters");

	const express = require("express");

	// 数据库模块
	const connectPromiser = require("./db/db");
	await connectPromiser;
	console.log("数据库连接成功");
	const app = express();

	app.use(express.urlencoded({ extended: false }));
	//   访问静态资源
	app.use(express.static("./web"));
	app.use(logicRouter);
	app.use(uiRouter);

	app.listen(666, (err) => {
		if (err) {
			console.log("服务器启动失败", err);
		} else console.log("服务器启动成功");
	});
})();
